/* Font Faces */

@font-face {
  font-family: 'EB Garamond';
  src: url('/assets/fonts/EBGaramond-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'EB Garamond';
  src: url('/assets/fonts/EBGaramond-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'EB Garamond';
  src: url('/assets/fonts/EBGaramond-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Design Tokens */

:root {
    /* Colors */
    --ink: #111;
    --paper: #f1ede3;
    --panel: #ebe4d5;
    --border: #9f9580;
    --accent: #9f9580;
	--green-text: #1f6f3f;
	--red-text: #8b2e2e;
	--blue-text: #2f6fb0;

    --link-default: #245f99;   /* slate blue */
    --link-visited: #9a3b2e;   /* copperplate */

    /* Layout */
    --page-width: 96%;
    --page-max-width: 102ch;
    --page-min-width: 32ch;

    --main-padding: 0.5rem;
	--main-padding-bottom: 2rem; /* bottom of page in <main> */
    --text-gutter: clamp(0.75rem, 9.5vw, 8rem);
    --h3-indent: clamp(0.5rem, 7.5vw, 6rem);
    --link-desc-indent: clamp(0.4rem, 2.5vw, 4rem);

    /* Typography */
    --base-font-size: 140%;
    --body-line-height: 1.2;
    --heading-letterspacing: 0.05em;
    --heading-margin-bottom: 0.3rem;

    /* Decorations */
    --h2-underline-width: 60px;
    --h2-underline-height: 2px;
    --ornament-height: 8px;

    /* Footer */
    --footer-font-size: 0.8rem;
    --footer-gap: 0.7rem;
}


/* Global Element Defaults */

html {
    font-size: var(--base-font-size);
}

body {
    font-family: "EB Garamond", "Times New Roman", serif;
    background-color: var(--paper);
    color: var(--ink);
    line-height: var(--body-line-height);
    text-rendering: optimizeLegibility;
    margin: 0;
}

a {
    color: var(--link-default);
}

a:visited {
    color: var(--link-visited);
}


/* Layout Containers */

.page-fit {
    width: var(--page-width);
    max-width: var(--page-max-width);
    min-width: var(--page-min-width);
    margin: 0 auto;
}

main {
    border: 3px solid var(--border);
    padding: var(--main-padding);
	padding-bottom: var(--main-padding-bottom);
    background: var(--panel);
}


/* Typography */

h1, h2, h3 {
    font-variant-caps: small-caps;
    letter-spacing: var(--heading-letterspacing);
    margin-bottom: var(--heading-margin-bottom);
}

h1 {
    margin-top: 0.9rem;
    text-align: center;
}

h2 {
    text-align: center;
    position: relative;
    padding-bottom: 0.4rem;
    margin-bottom: 1.4rem;
}

h2::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: var(--h2-underline-width);
    height: var(--h2-underline-height);
    background-color: var(--accent);
    opacity: 0.9;
}

h3 {
    margin-left: var(--h3-indent);
}

p, ul, ol, h4 {
    margin-left: var(--text-gutter);
	margin-right: var(--text-gutter);
    line-height: 1.5;
}

.subtitle, .copyright {
    font-style: italic;
    text-align: center;
    margin: 0;
	font-size: 90%;
}

/* Ornament (Header Divider) */

.ornament {
    position: relative;
    display: block;
    height: var(--ornament-height);
    margin: 1rem 0;
    background: repeating-linear-gradient(
        90deg,
        var(--accent) 0 2px,
        transparent 2px 6px
    );
    opacity: 0.9;
}

.ornament::after,
footer::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background-image: linear-gradient(
        to bottom,
        var(--accent) 0 1px,
        transparent 1px 2px,
        var(--accent) 2px 3px
    );
    opacity: 0.9;
}

.ornament::after {
    bottom: -12px;
}

/* Lists & Link Descriptions */

.link-desc {
    margin: 0.2rem var(--link-desc-indent) 0;
}

/* Unordered lists: custom arrow style */
ul {
    list-style: none;
    padding-left: 1.2rem;
}

ul li,
ol li {
    position: relative;
    margin: 0.3rem 0;
    padding-left: 0.9rem;
}
ul li::before {
    content: "›";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 120%;
    line-height: 1;
    color: var(--ink);
}

ol {
    list-style: decimal;
	list-style-position: inside;
	padding-left: 0;
}


/* Footer */

footer {
    display: flex;
    justify-content: center;
    gap: var(--footer-gap);
    text-align: center;
    padding-top: 0.7rem;
    margin: 0.5rem 0 1rem;
    position: relative;
    font-size: var(--footer-font-size);
}

footer::before {
    top: 0;
}

/* Button */

.button {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--border);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.45),
        inset 0 -1px 0 rgba(0,0,0,.25),
        1px 1px 0 rgba(0,0,0,.08);
    background: linear-gradient(var(--paper), var(--panel));
    color: var(--ink);
    font-family: "EB Garamond", "Times New Roman", serif;
    font-size: 1rem;
    letter-spacing: 0.02em;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    display: inline-block;
    line-height: 1.2;
    user-select: none;
    text-decoration: none;
    background-clip: padding-box;
}

.button:hover {
    filter: brightness(1.02);
}

.button:focus-visible,
.prior-remove:focus-visible {
    outline: 2px solid var(--link-default);
    outline-offset: 2px;
}

.button:active {
    box-shadow:
        inset 0 -1px 0 rgba(255,255,255,.45),
        inset 0 1px 0 rgba(0,0,0,.25),
        0 0 0 rgba(0,0,0,0);
    background: linear-gradient(var(--panel), var(--paper));
    transform: translateY(1px);
}

/* Makes the button text black */
.button,
.button:link,
.button:visited,
.button:hover,
.button:active,
.button:focus {
    color: var(--ink) !important;
    text-decoration: none;
}


/* Honeypot (form forms) */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* One-off right-align */
.align-right {
    text-align: right;
}

/* One-off center-align */
.align-center {
	text-align: center;
}


/* forms */

.form,
.portal-wrap{
	margin-left: var(--text-gutter);
	margin-right: var(--text-gutter);
}

.form {
	margin-top: 2rem;
}

form p {
	text-align: center;
}

form button {
	margin-top: 1.2rem;
}

.field {
	margin: 0.35rem 0;
	margin-left: 1.2rem;
	margin-top: 1.2rem;
}

.field label {
	display: block;
	margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea,
.form select {
	width: 100%;
	box-sizing: border-box;
	max-width: 22ch;
	margin: 0.7rem var(--link-desc-indent) 0.7rem;
	font-size: 100%;
	font-family: inherit;
}

/* Register page: keep H3 aligned inside forms + give breathing room */
.form h3 {
  margin-left: 0;
  margin-bottom: 1.2rem;
}

/* Selects should visually match text inputs */
.form select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.form button {
  margin-bottom: 1.2rem;
}

/* Checkbox rows: hard-align box + text, ignore global label spacing */
.checkbox-field label {
  display: grid;
  grid-template-columns: 1.1rem 1fr; /* checkbox column + text column */
  column-gap: 0.45rem;              /* actual visual spacing */
  align-items: start;
  margin: 0;
  padding: 0;
  text-indent: 0;
}

/* Nuke any inherited padding/margins that cause “2 inch gap” */
.checkbox-field label * {
  margin-left: 0;
}

.checkbox-field input[type="checkbox"] {
  margin: 0.15rem 0 0 0;
  justify-self: start;
}

.checkbox-field label span {
  grid-column: 2;
}

/* Prior scores list: no UL indent, align right */
.prior-list {
  text-align: right;
  margin-top: 0.6rem;
}

.prior-item {
  margin: 0.25rem 0;
}


/* form statuses */

.form-status {
  text-align: center;

  min-height: 1.6em;      /* reserves space even when empty */
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;

  font-size: 0.95em;
  line-height: 1.4;
}

.form-status.ok {
  color: var(--green-text); /* subdued green */
}

.form-status.err {
  color: var(--red-text); /* subdued red */
}

/* ELIGIBILITY DROPDOWN SUPPORT */

/* Move the horizontal indent to the wrapper so the dropdown and input align */
.input-group {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 22ch;

  /* was: margin: 0; */
  margin: 0.7rem var(--link-desc-indent) 0.7rem;
}

.input-group input {
  width: 100%;
  max-width: 22ch;
  box-sizing: border-box;

  /* was: margin: 0.7rem var(--link-desc-indent) 0.7rem; */
  margin: 0;

  font-family: inherit;
  font-size: 100%;
}

/* The Dropdown Menu */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-top: none;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 250px; 
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    /* MATCH THE INPUT FONT */
    font-family: inherit;
}

.suggestions-list li {
    display: block; 
    padding: 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
    color: #333;
}

/* Remove the custom website arrow (>) */
.suggestions-list li::before {
    content: none;
}

.suggestions-list li:hover {
    background-color: #f0f0f0;
    color: #000;
}

#result-box { font-size: 0.95em; }

/* Prior score remove button (icon-only) */
.prior-remove {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  color: var(--red-text);
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0.05rem 0.35rem;
  margin-left: 0.5rem;
  cursor: pointer;
}

.prior-remove:hover {
  filter: brightness(0.95);
}


/* --- Added items grid (languages / prior scores) --- */
.added-grid{
  display: grid;
  gap: 10px;
  margin-top: 10px;

  /* Never overflow: each column is max 320px, but can shrink to fit */
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 320px));

  /* Looks good at all widths: single card is centered, multi cards fill nicely */
  justify-content: start;
}

.added-card{
  position: relative;
  border-radius: 0;

  background: var(--paper);
  border: 2px solid var(--border);  /* thicker like your page border */

  padding: 12px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
}

.added-title{
  font-weight: 700;
  margin: 0 34px 8px 0;
  line-height: 1.2;
  word-break: break-word;
}

.added-meta{
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 10px;
  font-size: 0.95rem;
}

.added-meta .k{
  opacity: 0.75;
  white-space: nowrap;
}

.added-meta .v{
  word-break: break-word;
}

/* Bigger X, no circle, higher up, still inside the card */
.added-remove{
  position: absolute;
  top: 0;
  right: 0;

  /* push it up/right, then pull it back inside so it never bleeds out */
  transform: translate(-8px, -12px);

  border: 0;
  background: transparent;
  color: inherit;

  font-size: 22px;      /* bigger */
  line-height: 1;
  padding: 0;

  width: 28px;          /* keeps click target reasonable */
  height: 28px;
  display: grid;
  place-items: center;

  cursor: pointer;
  opacity: 0.75;
}

.added-remove:hover{
  opacity: 1;
}

.radio-group {
  display: flex;
  /* Align with other form controls that use the standard left indent */
  margin: 0.7rem 0 0.7rem;
}

/* Override .field label { display:block } for inline radio labels */
.field .radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0;
  cursor: pointer;
}

/* Prevent nested <span> text from inheriting odd line-height defaults */
.field .radio-inline span {
  line-height: 1;
}

.field .radio-inline input[type="radio"] {
  transform: scale(1.25);
  margin: 0 1.2rem 0 clamp(1.2rem, 2.5vw, 4rem);
}

/* Portal grid */
.portal-wrap{
	margin-top: 0.35rem;
}

/* The “grid” itself */
.portal-table{
  width: 100%;
  border-collapse: collapse;
  background: transparent;          /* no paper box */
  border: none;                      /* no outline */
  margin-top: 0.45rem;
}

.portal-table th,
.portal-table td{
  padding: clamp(0.35rem, 1.1vw, 0.60rem); /* smooth desktop→mobile */
  vertical-align: top;
  background: transparent;                 /* remove header shading */
}

.portal-table th:first-child,
.portal-table td:first-child{ padding-left: 0.2rem; }

.portal-table th:last-child,
.portal-table td:last-child{ padding-right: 0.2rem; }

/* Thick rule under header */
.portal-table thead th{
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
  padding-bottom: clamp(0.35rem, 1.1vw, 0.60rem);
}

/* Thin separators between rows */
.portal-table tbody tr{
  border-bottom: 1px solid var(--border);
}

/* Keep action column tight-ish without forcing a breakpoint */
.portal-table td:last-child{
  white-space: normal;
}

/* Status colors (used by portal.js) */
.portal-status-complete,
.portal-status-approved{
  color: var(--green-text);
  font-weight: 600;
}
.portal-status-review{
  color: var(--blue-text); /* your existing blue-ish token */
  font-weight: 600;
}
.portal-status-rejected{
  color: var(--red-text);
  font-weight: 600;
}

.portal-schedule{
  margin-top: 1.2rem;   /* creates separation from the grid */
}
