/* StudyGuard — buttons, cards, plans, forms and the cookie notice. */

/* Buttons ----------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  /* Never smaller than a comfortable thumb target. */
  min-height: 44px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out);
}

.button--primary {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--white);
}

.button--primary:hover {
  background-color: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  color: var(--white);
}

.button--gold {
  background-color: var(--gold-600);
  border-color: var(--gold-600);
  color: var(--white);
}

.button--gold:hover {
  background-color: var(--gold-700);
  border-color: var(--gold-700);
  color: var(--white);
}

.button--ghost {
  background-color: transparent;
  border-color: var(--grey-300);
  color: var(--navy-800);
}

.button--ghost:hover {
  border-color: var(--navy-700);
  color: var(--navy-800);
}

.hero .button--ghost {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--white);
}

.hero .button--ghost:hover {
  border-color: var(--white);
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

/* The button rises towards the cursor; a mouse only, so nothing sticks on touch. */
@media (hover: hover) and (pointer: fine) {
  .button:hover:not([disabled]) {
    transform: translateY(var(--lift));
  }

  .button--primary:hover:not([disabled]) {
    box-shadow: var(--shadow-accent);
  }

  .button--gold:hover:not([disabled]) {
    box-shadow: var(--shadow-gold);
  }

  .button--ghost:hover:not([disabled]) {
    box-shadow: var(--shadow-md);
  }

  .hero .button--ghost:hover:not([disabled]) {
    box-shadow: none;
  }
}

/* Pressing settles the button back down, so a tap feels physical. */
.button:active:not([disabled]) {
  transform: translateY(0) scale(0.985);
  box-shadow: var(--shadow-sm);
}

.button--compact {
  min-height: 40px;
  padding: var(--space-2) var(--space-4);
}

.button--block {
  width: 100%;
}

.button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Panels and cards -------------------------------------------------------- */

.panel {
  padding: var(--space-6);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background-color: var(--white);
}

.panel--accent {
  border-left: 3px solid var(--color-accent);
  background-color: var(--green-050);
}

/*
 * Hover lifts use the independent `translate` / `scale` properties rather than
 * `transform`. The scroll-in reveal in base.css animates `transform`, and a
 * running animation outranks a normal declaration, so a `transform` here would
 * simply be ignored once the reveal has played.
 */
.card {
  padding: var(--space-5);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background-color: var(--white);
  box-shadow: var(--shadow-card);
  transition:
    translate var(--duration) var(--ease-out),
    scale var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out),
    border-color var(--duration) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    translate: 0 var(--lift);
    border-color: var(--green-200);
    box-shadow: var(--shadow-lg);
  }
}

.card--quiet {
  box-shadow: none;
  background-color: var(--grey-050);
}

.card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.step {
  padding: var(--space-5);
  border-top: 3px solid var(--color-accent);
  background-color: var(--grey-050);
  transition:
    translate var(--duration) var(--ease-out),
    background-color var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .step:hover {
    translate: 0 var(--lift);
    background-color: var(--white);
    box-shadow: var(--shadow-md);
  }
}

.step__number {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
}

.step p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Mentor cards ------------------------------------------------------------ */

.mentor {
  display: flex;
  flex-direction: column;
}

.mentor__photo {
  margin-bottom: var(--space-4);
  border-radius: var(--radius-sm);
  /* Keeps the zoom below cropped inside the frame. */
  overflow: hidden;
  background-color: var(--grey-100);
}

.mentor__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

/* Shown until a real photo is added to the data file. */
.mentor__monogram {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  background-color: var(--grey-100);
  background-image: linear-gradient(150deg, var(--grey-050), var(--grey-200));
  border: 1px solid var(--grey-200);
  color: var(--navy-700);
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: 0.04em;
  transition:
    transform var(--duration-slow) var(--ease-out),
    color var(--duration) var(--ease-out),
    background-image var(--duration) var(--ease-out);
}

/* Hovering the card pushes the portrait in a little, the way a good gallery does. */
@media (hover: hover) and (pointer: fine) {
  .mentor:hover .mentor__img,
  .mentor:hover .mentor__monogram {
    transform: scale(1.07);
  }

  .mentor:hover .mentor__monogram {
    color: var(--color-accent-strong);
    background-image: linear-gradient(150deg, var(--green-050), var(--green-200));
  }

  .mentor:hover .mentor__credential {
    color: var(--color-accent);
  }
}

.mentor__name {
  margin-bottom: var(--space-1);
  font-size: var(--text-lg);
}

.mentor__credential {
  margin-bottom: var(--space-3);
  color: var(--color-accent-strong);
  font-size: var(--text-sm);
  font-weight: 600;
}

.mentor__specialisation,
.mentor__experience {
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.mentor__experience:last-child {
  margin-bottom: 0;
}

/* Plans ------------------------------------------------------------------- */

.plan {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background-color: var(--white);
  box-shadow: var(--shadow-card);
  transition:
    translate var(--duration) var(--ease-out),
    scale var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out),
    border-color var(--duration) var(--ease-out);
}

.plan--featured {
  border-color: var(--color-accent);
  border-width: 2px;
  background-color: var(--green-050);
  box-shadow: var(--shadow-md);
}

@media (hover: hover) and (pointer: fine) {
  .plan:hover {
    translate: 0 var(--lift-lg);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-lg);
  }
}

/*
 * The recommended plan sits slightly proud of the other two on a wide screen.
 * `scale` is independent of `translate`, so the hover lift above still applies
 * on top of it without either rule having to repeat the other.
 */
@media (min-width: 861px) {
  .plan--featured {
    scale: 1.025;
  }
}

.plan__badge {
  display: inline-block;
  align-self: flex-start;
  margin: 0 0 var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background-color: var(--color-accent);
  color: var(--white);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plan__name {
  margin-bottom: var(--space-2);
  font-size: var(--text-xl);
}

.plan__price {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.plan__amount {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--navy-800);
}

.plan__period {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.plan__summary {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.plan__features {
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
  flex-grow: 1;
}

.plan__features li {
  position: relative;
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  border-bottom: var(--border-hairline);
  font-size: var(--text-sm);
}

.plan__features li:last-child {
  border-bottom: 0;
}

.plan__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-accent);
}

/* Checklist and FAQ ------------------------------------------------------- */

.checklist {
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  font-size: var(--text-sm);
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--gold-600);
}

.faq {
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background-color: var(--white);
}

.faq__item {
  border-bottom: var(--border-hairline);
}

.faq__item:last-child {
  border-bottom: 0;
}

.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  /* Replaces the browser's default triangle with the chevron below. */
  list-style: none;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

/* Chevron drawn from two borders: it points down, and flips up when open. */
.faq__item summary::after {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-right: 2px;
  border-right: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  transform: rotate(45deg);
  transition: transform var(--duration) var(--ease-out);
}

.faq__item[open] summary::after {
  transform: rotate(-135deg);
}

@media (hover: hover) and (pointer: fine) {
  .faq__item summary:hover {
    background-color: var(--green-050);
    color: var(--color-accent-strong);
  }
}

.faq__item p {
  margin: 0;
  padding: 0 var(--space-5) var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* The answer fades in rather than snapping into place. */
.faq__item[open] p {
  animation: sg-fade-in var(--duration) var(--ease-out) both;
}

@keyframes sg-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Long-form text, used by the privacy notice ------------------------------ */

.prose {
  max-width: 760px;
}

.prose h2 {
  margin-top: var(--space-7);
  font-size: var(--text-xl);
}

.prose ul {
  margin-bottom: var(--space-4);
  padding-left: var(--space-5);
  color: var(--color-text-muted);
}

.prose li {
  margin-bottom: var(--space-2);
}

.prose__meta {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Contacts ---------------------------------------------------------------- */

.contact-list {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.contact-link {
  position: relative;
  display: flex;
  flex-direction: column;
  /* Room on the right for the arrow that appears on hover. */
  padding: var(--space-4) var(--space-8) var(--space-4) var(--space-5);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background-color: var(--white);
  text-decoration: none;
  transition:
    translate var(--duration) var(--ease-out),
    scale var(--duration) var(--ease-out),
    border-color var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out);
}

.contact-link:hover {
  border-color: var(--color-accent);
}

.contact-link::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: var(--space-5);
  color: var(--color-accent);
  font-size: var(--text-lg);
  opacity: 0;
  transform: translateY(-50%) translateX(-6px);
  transition:
    opacity var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .contact-link:hover {
    translate: 0 var(--lift);
    box-shadow: var(--shadow-md);
  }

  .contact-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Keyboard users get the same affordance. */
.contact-link:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.contact-link__label {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-link__value {
  color: var(--navy-800);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
}

.contact-note {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Forms ------------------------------------------------------------------- */

.form-card {
  padding: var(--space-6);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background-color: var(--white);
  box-shadow: var(--shadow-card);
}

.form-card--gold {
  border-color: var(--gold-200);
}

/*
 * The request form sits between the plans and the FAQ. Stretched across the
 * full container its inputs would be uncomfortably wide, so it keeps a centred
 * reading width and its own breathing room above.
 */
.form-card--narrow {
  max-width: 720px;
  margin: var(--space-8) auto 0;
}

.form-card__lead {
  margin-bottom: var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.field__hint {
  color: var(--color-text-muted);
  font-weight: 400;
}

.field input[type="text"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  /* 16px keeps iOS from zooming in when the field is focused. */
  padding: var(--space-3);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background-color: var(--white);
  font-size: var(--text-base);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--grey-500);
}

/* Soft accent halo on the active field, on top of the usual focus outline. */
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(63, 107, 82, 0.16);
}

.field__error {
  margin: var(--space-2) 0 0;
  color: var(--danger-600);
  font-size: var(--text-xs);
}

.field__error:empty {
  display: none;
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: var(--danger-600);
}

.field--checkbox {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
}

.field--checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.field--checkbox label {
  margin: 0;
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.field--checkbox .field__error {
  grid-column: 1 / -1;
}

/* The honeypot must stay in the DOM but never be visible or focusable. */
.field--honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__note {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.form__status {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
}

.form__status:empty {
  display: none;
}

.form__status--success {
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--color-accent);
  background-color: var(--green-050);
  color: var(--color-accent-strong);
}

.form__status--error {
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--danger-600);
  background-color: #fbf0ef;
  color: var(--danger-600);
}

/* Cookie notice ----------------------------------------------------------- */

.consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background-color: var(--navy-900);
  color: var(--grey-200);
  box-shadow: var(--shadow-lg);
  /* Clears the home-screen indicator on modern iPhones. */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.consent[hidden] {
  display: none;
}

/* Slides up once the script decides the notice is needed. */
.consent:not([hidden]) {
  animation: sg-consent-in var(--duration-slow) var(--ease-out) both;
}

@keyframes sg-consent-in {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.consent__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.consent__text {
  margin: 0;
  font-size: var(--text-sm);
}

.consent__actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

.consent .button--ghost {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--white);
}

@media (max-width: 620px) {
  .form__row {
    grid-template-columns: minmax(0, 1fr);
  }

  .consent__inner {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }

  /* Both consent buttons full width and side by side, easy to hit. */
  .consent__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .consent__actions .button {
    width: 100%;
  }

  .form-card,
  .panel,
  .plan {
    padding: var(--space-5);
  }

  /* A tapped card should still acknowledge the touch. */
  .card:active,
  .plan:active,
  .contact-link:active {
    scale: 0.99;
  }

  /*
   * Mentor card on a phone: thumbnail on the left, all the text to the right.
   * The photo is placed explicitly and every other child is sent to column 2,
   * so cards work whether or not they carry a specialisation or experience line.
   */
  .mentor {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    column-gap: var(--space-4);
    align-items: start;
    padding: var(--space-4);
  }

  .mentor__photo {
    grid-column: 1;
    grid-row: 1 / span 6;
    width: 84px;
    margin-bottom: 0;
  }

  .mentor > :not(.mentor__photo) {
    grid-column: 2;
  }

  .mentor__monogram {
    font-size: var(--text-xl);
  }

  .mentor__name {
    margin-bottom: var(--space-2);
  }
}
