/* ------------------------------------------------------------------
   Patiala Foundation — staff & volunteer portal

   The palette is taken from the Foundation's own logo: the orange of the
   interlocking squares, black type, white ground. Deliberately NOT the
   MM Central State Library's heritage red — that is a public site for a
   different organisation, and nobody should ever confuse the two.
   ------------------------------------------------------------------ */

:root {
  --accent: #e07b45;
  --accent-ink: #c05e29;
  --accent-soft: #f4a077;
  --sand: #fbf3ed;
  --sand-deep: #f3e3d8;
  --paper: #fdfbf9;
  --surface: #ffffff;
  --ink: #1b1715;
  --ink-soft: #5a524c;
  --ink-faint: #8b817a;
  --line: #e8ddd4;

  --wrap: 64rem;
  --radius: 12px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --accent: #f09a6e;
  --accent-ink: #f7b996;
  --accent-soft: #c97a4c;
  --sand: #241d18;
  --sand-deep: #2e2620;
  --paper: #14100d;
  --surface: #1d1814;
  --ink: #efe6dd;
  --ink-soft: #bfb4aa;
  --ink-faint: #8f857c;
  --line: #342b24;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/*
  The browser hides [hidden] at the lowest possible specificity, so any class
  rule that sets `display` beats it and the element stays on screen. Settled
  here once, as it was in the library project, rather than being rediscovered.
*/
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 ui-sans-serif, system-ui, 'Segoe UI', Roboto, sans-serif;
  /* A pasted Google Forms URL is one unbreakable word ~90 characters long.
     Without this it pushes the whole page sideways on a phone. */
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  line-height: 1.22;
  margin: 0;
  text-wrap: balance;
}

a {
  color: var(--accent-ink);
  text-underline-offset: 2px;
}
a:hover {
  color: var(--accent);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 16px;
}

.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 700;
  margin: 0 0 0.4rem;
}

.muted {
  color: var(--ink-faint);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 0.93rem;
  text-decoration: none;
  padding: 0.65em 1.1em;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover {
  background: var(--accent-ink);
  color: #fff;
}
/*
  In dark mode the orange is light, so a solid button needs dark text on it.
  This must NOT reach .btn.ghost — a ghost button has no orange fill, and
  giving it near-black text made "Edit links" and "Sign out" all but
  invisible against the dark bar. Found by looking at the page, not the CSS.
*/
:root[data-theme='dark'] .btn:not(.ghost),
:root[data-theme='dark'] .btn:not(.ghost):hover {
  color: #1b1310;
}
.btn.ghost {
  background: transparent;
  color: var(--accent-ink);
  border-color: var(--line);
}
.btn.ghost:hover {
  background: var(--sand);
  color: var(--accent-ink);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- the sign-in gate (shared by /signin and /admin) ---------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.box {
  width: min(100%, 24rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.7rem 1.5rem;
}
.box .mark {
  display: block;
  width: min(100%, 15rem);
  margin: 0 auto 1.3rem;
}

/*
  The logo is a transparent PNG with BLACK lettering, so on a dark page the
  word "PATIALA FOUNDATION" and the motto under it disappear and only the
  orange tiles are left. Inverting it would turn the orange blue, so instead
  it is given the white ground it was drawn for. The mark keeps its own
  colours; only the surface behind it changes.
*/
:root[data-theme='dark'] .box .mark,
:root[data-theme='dark'] .mast img {
  background: #fff;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
}
.box h1 {
  font-size: 1.05rem;
  text-align: center;
}
.box .sub {
  margin: 0.3rem 0 1.5rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.box label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.box input[type='password'] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
.box .btn {
  width: 100%;
  margin-top: 1rem;
}

.err {
  margin: 0.85rem 0 0;
  color: var(--accent-ink);
  font-size: 0.85rem;
}

.cool {
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.cool strong {
  display: block;
  color: var(--accent-ink);
  font-size: 0.86rem;
}
.cool p {
  margin: 0.3rem 0 0.6rem;
  font-size: 0.84rem;
  color: var(--ink-soft);
}
.cool .bar {
  height: 4px;
  border-radius: 99px;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.cool .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 1s linear;
}

/* ---------- the bar across the top of a signed-in page ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  /* The gutter matches .wrap so the bar's contents line up with the page. */
  padding: 0.6rem 16px;
  background: var(--sand);
  border-bottom: 1px solid var(--line);
  /* On a narrow phone the two groups of buttons stack rather than squeeze. */
  flex-wrap: wrap;
}
.top .who {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.top-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.top .btn {
  padding: 0.45em 0.8em;
  font-size: 0.84rem;
}
.dirty {
  margin-left: 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-ink);
}

.icon-btn {
  font: inherit;
  font-size: 0.84rem;
  line-height: 1;
  padding: 0.5em 0.6em;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover {
  color: var(--accent-ink);
  border-color: var(--accent-soft);
}

.pad {
  padding-block: 1.6rem 3.5rem;
}

/* ---------- portal masthead ---------- */

.mast {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  padding-block: 1.6rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.mast img {
  width: min(100%, 17rem);
  flex: none;
}
.mast .status {
  flex: 1 1 16rem;
  min-width: 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 0;
}

.notice {
  margin: 1.3rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 0.92rem;
}
.notice strong {
  color: var(--accent-ink);
}

/* ---------- search ---------- */

.find {
  margin: 1.4rem 0 0.4rem;
}
.find input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.find input::placeholder {
  color: var(--ink-faint);
}

/* ---------- the link groups ---------- */

.groups {
  display: grid;
  gap: 1rem;
  margin-top: 1.4rem;
  /* auto-fit, not auto-fill: one card does not sit in a half-empty row.
     minmax's first value is 0 via min(), so a long URL cannot force the
     column wider than the screen — the usual cause of sideways scroll. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
}

.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1rem;
  min-width: 0;
}
.group h2 {
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.group .note {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.links {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  min-width: 0;
}
.links a:hover {
  border-color: var(--accent-soft);
  background: var(--sand);
  color: var(--ink);
}
.links a .label {
  flex: 1 1 auto;
  min-width: 0;
}
.links a .arrow {
  flex: none;
  color: var(--ink-faint);
}
.links a:hover .arrow {
  color: var(--accent-ink);
}

/* The little pill that says what a destination IS — form, responses,
   dashboard. A form and the sheet its answers land in look identical as
   URLs, so the pill is the only thing telling them apart at a glance. */
.kind {
  flex: none;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.45rem;
  border-radius: 99px;
  background: var(--sand-deep);
  color: var(--ink-soft);
}
.kind.form {
  background: var(--accent);
  color: #fff;
}
:root[data-theme='dark'] .kind.form {
  color: #1b1310;
}
.kind.responses {
  background: #2f7d5f;
  color: #fff;
}
.kind.dashboard {
  background: #3a5f9e;
  color: #fff;
}
.kind.doc {
  background: #6b5aa6;
  color: #fff;
}

.empty {
  margin-top: 2rem;
  padding: 1.6rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--sand);
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: center;
}

/* ---------- portal footer ---------- */

.foot {
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.foot .motto {
  color: var(--accent-ink);
  font-weight: 600;
  margin: 0 0 0.6rem;
}
.foot .reach {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}
.foot .social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.foot .social a {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- admin ---------- */

.tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.tab {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.tab.is-on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
:root[data-theme='dark'] .tab.is-on {
  color: #1b1310;
}

.hint,
.warn {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-faint);
  margin: 0 0 1rem;
}
.warn {
  color: var(--accent-ink);
}

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
  margin-bottom: 0.9rem;
}
.item.is-off {
  border-style: dashed;
  background: var(--sand);
}
.item-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.item-head .grow {
  flex: 1 1 auto;
  min-width: 0;
}

.tag {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  background: var(--sand-deep);
  color: var(--ink-faint);
}
.tag.live {
  background: var(--accent);
  color: #fff;
}
:root[data-theme='dark'] .tag.live {
  color: #1b1310;
}

.f {
  display: block;
  margin-bottom: 0.7rem;
}
.f span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.f input,
.f textarea,
.f select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
.f textarea {
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.5;
}
.f .fieldnote {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-faint);
  font-weight: 400;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}
.sw {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.del {
  background: none;
  border: 0;
  color: var(--accent-ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.2rem;
}
.del:hover {
  text-decoration: underline;
}
.mini {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.7em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.mini:hover {
  border-color: var(--accent-soft);
  color: var(--accent-ink);
}

/* One destination inside a project card, in the admin. Three fields on a
   wide screen, stacked on a phone — never squeezed to unusable widths. */
.dest {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
  align-items: end;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 0.55rem;
  background: var(--paper);
}
@media (min-width: 46rem) {
  .dest {
    grid-template-columns: 1.1fr 2fr 0.8fr auto;
  }
}
.dest .f {
  margin-bottom: 0;
  min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
