/* Public account pages: sign-in, sign-up, password and account. Loaded only by those pages. See DESIGN.md. */

:root {
  --portal-hero: linear-gradient(155deg, #0A2A0A 0%, var(--secondary) 55%, var(--secondary-dark) 100%);
  --portal-submit: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  --portal-on-hero: rgba(255,255,255,0.84);
  --portal-err-bg: rgba(200,100,10,0.08);
  --portal-err-line: rgba(200,100,10,0.32);
  --portal-ok-bg: rgba(27,94,32,0.09);
  --portal-ok-line: rgba(27,94,32,0.3);
  --portal-danger-bg: rgba(139,26,26,0.07);
  --portal-danger-line: rgba(139,26,26,0.4);
  --portal-ease: cubic-bezier(0.25,1,0.5,1);
}

/* ---- Page frame ---- */
.portal-hero {
  background: var(--portal-hero);
  padding: 44px 0;
  position: relative;
  overflow: hidden;
}
.portal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%23ffffff" fill-opacity="0.03"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/svg%3E');
}
.portal-hero .container { position: relative; z-index: 1; }
.portal-hero h1 { color: var(--white); font-size: clamp(1.8rem, 4.2vw, 2.7rem); font-weight: 800; }
.portal-hero p { color: var(--portal-on-hero); font-size: 1.02rem; line-height: 1.6; margin-top: 8px; max-width: 640px; overflow-wrap: anywhere; }

.portal-main { padding: 40px 0 72px; }
/* Tamil and Malayalam run to very long single words: let them break rather than widen the page. */
.portal-hero, .portal-main { overflow-wrap: anywhere; }

/* ---- Cards ---- */
.portal-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 28px;
  min-width: 0;
  scroll-margin-top: 92px;
}
.portal-narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.portal-card h2 {
  color: var(--secondary-dark);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.portal-card p { line-height: 1.65; }
.portal-sub { color: var(--gray-600); font-size: 0.95rem; margin-bottom: 18px; }
.portal-card h2 + .portal-form, .portal-card h2 + .portal-banner { margin-top: 14px; }
.portal-body-gap { margin-bottom: 10px; }
.portal-card a:not(.portal-btn) {
  color: var(--secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.portal-card a:not(.portal-btn):hover { color: var(--secondary-dark); }

.portal-span { grid-column: 1 / -1; }

/* ---- Banners: one above each form ---- */
.portal-banner {
  border: 1px solid;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 20px;
  padding: 13px 16px;
  overflow-wrap: anywhere;
}
.portal-banner p + p { margin-top: 6px; }
.portal-banner p { line-height: 1.55; }
.portal-banner.is-err { background: var(--portal-err-bg); border-color: var(--portal-err-line); color: var(--primary-dark); }
.portal-banner.is-err a { color: inherit; }
.portal-banner.is-ok { background: var(--portal-ok-bg); border-color: var(--portal-ok-line); color: var(--secondary-dark); }
.portal-page-banners { scroll-margin-top: 92px; }

/* ---- Fields ---- */
.portal-form { min-width: 0; }
.portal-field { margin-bottom: 18px; min-width: 0; }
.portal-label {
  color: var(--gray-600);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  margin-bottom: 7px;
  text-transform: uppercase;
}
.portal-input {
  background: var(--cream);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-900);
  display: block;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.4;
  min-height: 48px;
  padding: 11px 14px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  width: 100%;
}
.portal-input:focus { background: var(--white); border-color: var(--secondary); outline: none; }
.portal-input[readonly] { background: var(--gray-100); color: var(--gray-700); }
select.portal-input { cursor: pointer; max-width: 100%; }
select.portal-input:disabled { background: var(--gray-100); color: var(--gray-700); cursor: not-allowed; }   /* district, until a State is chosen */
textarea.portal-input { min-height: 120px; resize: vertical; }
input[type="file"].portal-input { cursor: pointer; font-size: 0.92rem; padding: 9px 10px; }
.portal-hint { color: var(--gray-600); font-size: 0.86rem; line-height: 1.5; margin-top: 6px; }
.portal-username-box { position: relative; }
.portal-username-at { color: var(--gray-600); left: 14px; pointer-events: none; position: absolute; top: 50%; transform: translateY(-50%); }
.portal-username-box .portal-input { padding-left: 30px; }
.portal-username-status { font-size: 0.9rem; font-weight: 600; line-height: 1.5; margin-top: 6px; }
.portal-username-status .is-ok { color: var(--secondary); }
.portal-username-status .is-bad { color: #B3261E; }
.portal-row { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Password with a show or hide button inside the field */
.portal-pw { position: relative; }
.portal-pw .portal-input { padding-right: 104px; }
.portal-pw-toggle {
  border-radius: var(--radius-md);
  color: var(--secondary);
  font-size: 0.88rem;
  font-weight: 700;
  min-height: 44px;
  line-height: 1.15;
  max-width: 100px;
  min-width: 64px;
  padding: 0 8px;
  position: absolute;
  right: 2px;
  top: 2px;
}
.portal-pw-toggle:hover { background: var(--gray-100); }
html:not(.js) .portal-pw-toggle { display: none; }
html:not(.js) .portal-pw .portal-input { padding-right: 14px; }

/* Tick boxes */
.portal-check {
  align-items: flex-start;
  color: var(--gray-800);
  cursor: pointer;
  display: flex;
  font-size: 0.95rem;
  gap: 10px;
  line-height: 1.5;
  margin-bottom: 18px;
  min-height: 44px;
}
.portal-check input { accent-color: var(--secondary); flex: none; height: 22px; margin-top: 1px; width: 22px; }
.portal-check-text { min-width: 0; }

/* Spam trap: out of sight, and out of the tab order */
.portal-trap { height: 1px; left: -9999px; overflow: hidden; position: absolute; width: 1px; }

/* ---- Buttons ---- */
.portal-btn {
  align-items: center;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  font-size: 1rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1.3;
  min-height: 48px;
  padding: 11px 28px;
  position: relative;
  text-align: center;
  transition: transform var(--transition-fast) var(--portal-ease), box-shadow var(--transition-fast), background-color var(--transition-fast);
}
.portal-btn:hover { transform: translateY(-2px); }
/* Covers the gap the lift leaves, or a pointer on the bottom edge makes the button jump up and down */
.portal-btn:hover::after { bottom: -6px; content: ''; height: 6px; left: 0; position: absolute; right: 0; }
.portal-btn-primary { background: var(--portal-submit); box-shadow: var(--shadow-green); color: var(--white); }
.portal-btn-primary:hover { box-shadow: 0 8px 28px rgba(27,94,32,0.4); }
.portal-btn-ghost { background: var(--white); border-color: var(--secondary); color: var(--secondary); }
.portal-btn-ghost:hover { background: var(--portal-ok-bg); }
.portal-btn-danger { background: var(--white); border-color: var(--red-sandal); color: var(--red-sandal); }
.portal-btn-danger:hover { background: var(--portal-danger-bg); }
.portal-btn-block { width: 100%; }

.portal-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

/* ---- Account page ---- */

.portal-status-line { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; margin-bottom: 10px; }
.portal-status-line h2 { margin-bottom: 0; }
.portal-badge {
  border: 1px solid;
  border-radius: var(--radius-full);
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  padding: 5px 14px;
  text-transform: uppercase;
}
.portal-badge.is-draft { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-700); }
.portal-badge.is-pending { background: var(--sandal-cream); border-color: var(--sandal); color: var(--gray-800); }
.portal-badge.is-approved { background: var(--portal-ok-bg); border-color: var(--secondary); color: var(--secondary-dark); }
.portal-badge.is-rejected { background: var(--portal-err-bg); border-color: var(--primary); color: var(--primary-dark); }
/* An organisation's verified badge card on /account: a forest tick before the heading, and the request button greyed
   until the details it needs are saved */
.portal-verify h2 { align-items: center; display: flex; gap: 10px; }
.portal-verify-tick {
  align-items: center;
  background: var(--secondary);
  border-radius: 50%;
  color: var(--white);
  display: inline-flex;
  flex: none;
  height: 28px;
  justify-content: center;
  width: 28px;
}
.portal-verify-tick svg { height: 15px; width: 15px; }
.portal-verify-needs { margin-bottom: 12px; }
.portal-verify .portal-btn:disabled { cursor: not-allowed; opacity: 0.5; transform: none; box-shadow: none; }
.portal-note {
  background: var(--portal-err-bg);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 18px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
}
.portal-note strong { color: var(--primary-dark); display: block; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.portal-docname { color: var(--gray-700); font-size: 0.9rem; line-height: 1.5; margin-bottom: 8px; overflow-wrap: anywhere; }
.portal-danger { background: var(--white); border-color: var(--portal-danger-line); box-shadow: none; }
.portal-danger h2 { color: var(--red-sandal); }
.portal-danger-form { max-width: 480px; }

/* Local test mode only: links that would have been emailed */
.portal-devmail {
  background: var(--gray-100);
  border: 2px dashed var(--gray-400);
  border-radius: var(--radius-md);
  color: var(--gray-800);

  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 20px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
}
.portal-devmail p { line-height: 1.5; margin-top: 8px; }
.portal-devmail a { color: var(--secondary); text-decoration: underline; }

/* ---- Small screens ---- */

@media (max-width: 640px) {
  .portal-row { grid-template-columns: minmax(0, 1fr); }
  .portal-hero { padding: 30px 0; }
  .portal-main { padding: 24px 0 56px; }
  .portal-card { padding: 22px 18px; }
  .portal-card > .portal-form .portal-btn, .portal-actions .portal-btn { width: 100%; }
}

/* ---- Edit my page ---- */
.portal-link-box {
  background: var(--cream);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-900);
  font-size: 0.98rem;
  line-height: 1.5;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
  padding: 11px 14px;
}

/* Says who can and can't see something */
.portal-private {
  background: var(--sandal-cream);
  border: 1px solid var(--sandal);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  padding: 14px 16px;
}
.portal-card h2 + .portal-private { margin-top: 14px; }
.portal-private strong { color: var(--gray-900); display: block; font-size: 1rem; line-height: 1.45; }
.portal-private p { color: var(--gray-800); font-size: 0.95rem; line-height: 1.55; margin-top: 4px; }
.portal-vis { color: var(--gray-700); }
.portal-account-note a { align-items: center; display: inline-flex; min-height: 44px; }

.portal-btn-small { font-size: 0.92rem; min-height: 44px; padding: 8px 18px; }
.portal-share-list { border-bottom: 1px solid var(--gray-100); list-style: none; margin: 0 0 14px; padding: 0; }
.portal-share-list li {
  align-items: center;
  border-top: 1px solid var(--gray-100);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  justify-content: space-between;
  min-height: 56px;
  padding: 6px 0;
}
.portal-share-list a { align-items: center; display: inline-flex; font-size: 1.02rem; min-height: 44px; min-width: 0; }
.portal-share-list form { flex: none; }
.portal-sub + .portal-hint, .portal-hint + .portal-hint { margin-top: 8px; }

/* ---- Community cards on the account page ---- */
.portal-card h2 + .portal-share-list { margin-top: 14px; }
.portal-post-tools { flex-basis: 100%; font-size: 0.95rem; }
.portal-post-tools summary { color: var(--gray-600); cursor: pointer; padding: 11px 0; text-decoration: underline; width: fit-content; }
.portal-post-tools summary:hover { color: var(--secondary); }
.portal-post-tools .portal-sub { margin: 4px 0 10px; }
.portal-post-tools form { padding-bottom: 8px; }
.portal-expert-note { background: var(--off-white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); margin-bottom: 16px; padding: 14px 16px; }
.portal-card h2 + .portal-expert-note { margin-top: 14px; }
.portal-expert-note p { margin: 0 0 10px; }

/* ---- Farm address in parts, on /edit-profile (owner's request of 2026-11-10) ----
   The village or road line, State and district side by side, then the PIN code with its check beside it (below it on
   phones). The group sits on cream with a hairline, under a small title with a pin. */
.farm-address { background: var(--cream); border: 0; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--gray-200); margin: 0 0 18px; min-width: 0; padding: 14px 16px 6px; }
.farm-legend { align-items: center; color: var(--secondary-dark); display: inline-flex; float: left; font-size: 0.78rem; font-weight: 800; gap: 6px; letter-spacing: 0.06em; margin-bottom: 10px; padding: 0; text-transform: uppercase; width: 100%; }
.farm-legend + * { clear: left; }
.farm-legend-ico { align-items: center; display: inline-flex; }
.farm-legend-ico .dash-svg { height: 15px; width: 15px; }
.farm-address .portal-input { background: var(--white); }
.farm-form > .portal-row { align-items: end; }     /* phone and trees: boxes line up when one label wraps */
.farm-pin-row { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.farm-pin { font-variant-numeric: tabular-nums; letter-spacing: 0.18em; max-width: 100%; width: 9.5em; }     /* six digits with room to spare */
.farm-pin-check { align-items: center; border-radius: var(--radius-full); display: inline-flex; font-size: 0.9rem; font-weight: 700; gap: 6px; line-height: 1.4; margin: 0; padding: 6px 12px; }
.farm-pin-check[hidden] { display: none; }
.farm-pin-check.is-ok, .farm-pin-check.is-filled { background: rgba(27,94,32,0.08); color: var(--secondary-dark); }
.farm-pin-check.is-other { background: var(--sandal-cream); box-shadow: inset 0 0 0 1px var(--sandal-light); color: var(--gray-900); font-weight: 600; }
.farm-pin-check.is-other strong { font-weight: 800; }
.farm-pin-check.is-bad { background: rgba(179,38,30,0.08); color: #8B1A1A; }
.farm-pin[aria-invalid="true"] { border-color: #B3261E; }
@media (max-width: 640px) {
  .farm-address { padding: 12px 12px 4px; }
  .farm-pin { max-width: none; width: 100%; }
  .farm-pin-check { border-radius: 12px; }
}
