/* ============================================================
   Harvest Valley — Auth pages
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --ink:        #402d1c;   /* deep bark brown text        */
  --ink-muted:  #7b5f45;   /* muted label                 */
  --card:       #fff6e3;   /* warm parchment panel        */
  --wood:       #b06b3a;   /* signboard frame             */
  --wood-dark:  #8a4f28;
  --line:       #e4cfa6;
  --field:      #fffaf0;
  --brand:      #4f9b3f;   /* leafy green                 */
  --brand-dark: #3c7c2f;
  --brand-soft: rgba(79, 155, 63, 0.18);
  --gold:       #f3c134;   /* wheat / sun                 */
  --barn:       #cf5b45;   /* barn red                    */
  --bad-bg:     #fce3dd;
  --bad-text:   #b0402c;
  --ok-bg:      #e4f3cf;
  --ok-text:    #3c7c2f;
  --radius:     22px;
  --shadow:     0 26px 50px rgba(74, 48, 20, 0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #a9def7 0%, #cdeefb 45%, #eafbe4 100%);
}

/* ---------- animated farm scene ---------- */
.scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

/* sun with slowly rotating rays */
.sun {
  position: absolute; top: 6%; left: 9%;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff2b0 0%, #ffd94d 60%, #f7c531 100%);
  box-shadow: 0 0 70px 26px rgba(247, 197, 49, 0.5);
}
.sun::before {
  content: ''; position: absolute; inset: -34px; border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg,
      rgba(247, 197, 49, 0.55) 0deg 8deg,
      transparent 8deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 66px, #000 67px);
          mask: radial-gradient(circle, transparent 66px, #000 67px);
  animation: spin 60s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* plump clouds */
.cloud {
  position: absolute; width: 140px; height: 46px;
  background: #ffffff; border-radius: 46px; opacity: 0.95;
  filter: drop-shadow(0 10px 12px rgba(90, 120, 150, 0.14));
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: #ffffff; border-radius: 50%; }
.cloud::before { width: 64px; height: 64px; top: -26px; left: 22px; }
.cloud::after  { width: 46px; height: 46px; top: -16px; left: 74px; }
.cloud.c1 { top: 14%; left: -220px; transform: scale(1.15); animation: drift 50s linear infinite; }
.cloud.c2 { top: 26%; left: -220px; transform: scale(0.85); animation: drift 68s linear infinite 10s; opacity: 0.85; }
.cloud.c3 { top: 8%;  left: -220px; transform: scale(0.6);  animation: drift 84s linear infinite 24s; opacity: 0.75; }
@keyframes drift { from { margin-left: 0; } to { margin-left: calc(100vw + 440px); } }

/* layered hills */
.hill { position: absolute; left: 50%; border-radius: 50%; transform: translateX(-50%); }
.hill.back  { width: 160vw; height: 340px; bottom: 60px;  background: #b7e08c; }
.hill.mid   { width: 140vw; height: 340px; bottom: 0;     background: #8ecb62; }
.hill.front { width: 180vw; height: 360px; bottom: -140px; background: #6bb245; }

/* ground */
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 150px; background: linear-gradient(180deg, #6bb245 0%, #549539 100%); }

/* little red barn on the mid hill */
.barn {
  position: absolute; bottom: 132px; right: 14%; width: 96px; height: 70px;
}
.barn .body { position: absolute; bottom: 0; width: 96px; height: 52px; background: var(--barn); border-radius: 4px; }
.barn .roof {
  position: absolute; top: 0; left: -6px; width: 0; height: 0;
  border-left: 54px solid transparent; border-right: 54px solid transparent;
  border-bottom: 24px solid #a8412f;
}
.barn .door { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 34px; background: #7f3226; border-radius: 4px 4px 0 0; }

/* white picket fence in front */
.fence { position: absolute; left: 0; right: 0; bottom: 96px; display: flex; justify-content: space-between; padding: 0 3vw; }
.picket { position: relative; width: 16px; height: 40px; background: #f3ead6; border-radius: 3px 3px 0 0; }
.picket::before { content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 8px solid #f3ead6; }
.picket::after { content: ''; position: absolute; top: 14px; left: -3vw; right: -3vw; height: 5px; background: #f3ead6; }

/* rows of crops swaying in the wind */
.crops {
  position: absolute; left: 0; right: 0; bottom: 118px;
  display: flex; justify-content: space-around; align-items: flex-end; padding: 0 5vw;
}
.plant { position: relative; width: 22px; height: 54px; transform-origin: bottom center; }
.plant .stem { position: absolute; left: 50%; bottom: 0; width: 5px; height: 100%; transform: translateX(-50%); border-radius: 5px; background: #3f8a30; }
.plant .leaf { position: absolute; width: 17px; height: 12px; border-radius: 0 14px 0 14px; background: #57a742; }
.plant .leaf.l { left: -5px;  bottom: 22px; transform: rotate(20deg); }
.plant .leaf.r { right: -5px; bottom: 32px; transform: scaleX(-1) rotate(20deg); }
/* alternating crop tops: golden wheat vs a red tulip bloom */
.plant .head { position: absolute; left: 50%; top: -8px; width: 15px; height: 19px; transform: translateX(-50%); border-radius: 50% 50% 44% 44%; background: var(--gold); }
.plant:nth-child(2n) .head { background: var(--barn); border-radius: 50% 50% 50% 50%; }
.plant:nth-child(3n) .head { background: #e46aa0; }

.plant { animation: sway 3s ease-in-out infinite; }
.plant:nth-child(3n)   { animation-delay: -0.4s; height: 60px; }
.plant:nth-child(3n+1) { animation-delay: -1.0s; }
.plant:nth-child(4n)   { animation-delay: -1.6s; height: 48px; }
.plant:nth-child(5n)   { animation-delay: -2.2s; }
@keyframes sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }

/* ---------- wooden signboard card ---------- */
.auth-card {
  position: relative; z-index: 1;
  width: min(420px, 100%);
  background: var(--card);
  border: 6px solid var(--wood);
  border-radius: var(--radius);
  box-shadow:
    inset 0 0 0 3px #f6e6c4,
    var(--shadow);
  padding: 34px 32px 30px;
}
/* two "nails" at the top corners for the signboard look */
.auth-card::before, .auth-card::after {
  content: ''; position: absolute; top: 12px; width: 12px; height: 12px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d9a86a, #9c6531);
}
.auth-card::before { left: 14px; }
.auth-card::after  { right: 14px; }

.brand-mark {
  width: 66px; height: 66px; margin: 0 auto 12px;
  display: grid; place-items: center;
  background: var(--brand-soft); border: 3px solid #cbe7bc; border-radius: 50%;
  font-size: 34px;
}

.auth-title {
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 2.1rem;
  text-align: center; color: var(--brand-dark); line-height: 1.05;
  text-shadow: 0 2px 0 #d9edcb;
}
.auth-subtitle { margin-top: 6px; text-align: center; color: var(--ink-muted); font-size: 0.98rem; font-weight: 600; }

.form-success {
  margin-top: 18px; background: var(--ok-bg); color: var(--ok-text);
  border: 2px solid #bfe295; border-radius: 14px;
  padding: 11px 14px; font-size: 0.92rem; font-weight: 800;
}

.auth-form { margin-top: 22px; display: grid; gap: 15px; }

.field { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 800; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.field input {
  font-family: inherit; font-size: 1rem; font-weight: 600; color: var(--ink);
  background: var(--field);
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: #c3b191; font-weight: 600; text-transform: none; letter-spacing: 0; }
.field input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* ---------- show / hide password toggle ---------- */
/* Wraps a password input; the eye button sits inside the field on the right. */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 50px; }
.pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: transparent;
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}
.pw-toggle:hover { background: var(--brand-soft); }
.pw-toggle:active { transform: translateY(-50%) scale(0.88); }
.pw-toggle:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
/* Swap which emoji shows based on the .is-shown state set by auth.js. */
.pw-toggle .pw-icon-hide { display: none; }
.pw-toggle.is-shown .pw-icon-show { display: none; }
.pw-toggle.is-shown .pw-icon-hide { display: inline; }

.auth-btn {
  margin-top: 6px;
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.15rem;
  color: #fff; background: var(--brand);
  border: 0; border-radius: 16px; padding: 13px;
  cursor: pointer;
  box-shadow: 0 7px 0 var(--brand-dark);
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.15s ease;
}
.auth-btn:hover { background: #58ab46; }
.auth-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--brand-dark); }
.auth-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: translateY(5px); box-shadow: 0 2px 0 var(--brand-dark); }

.form-error {
  background: var(--bad-bg); color: var(--bad-text);
  border: 2px solid #f0c3b8; border-radius: 14px;
  padding: 11px 14px; font-size: 0.9rem; font-weight: 800;
}

.auth-switch { margin-top: 20px; text-align: center; font-size: 0.94rem; color: var(--ink-muted); font-weight: 600; }
.auth-switch a { color: var(--brand-dark); font-weight: 800; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .cloud, .plant, .sun::before { animation: none !important; }
}
